Skip to content

Fixed the bug where selecting one side automatically selected the other side as well#87

Merged
Aeolun merged 1 commit into
Aeolun:mainfrom
wojiangkuanglong:fix-select
Apr 23, 2026
Merged

Fixed the bug where selecting one side automatically selected the other side as well#87
Aeolun merged 1 commit into
Aeolun:mainfrom
wojiangkuanglong:fix-select

Conversation

@wojiangkuanglong
Copy link
Copy Markdown

before:image

after:
image

@wojiangkuanglong wojiangkuanglong changed the title fix(select): mousedown and mouseup Fixed the bug where selecting one side automatically selected the other side as well Mar 12, 2026
@Aeolun Aeolun requested a review from Copilot April 23, 2026 03:44
@Aeolun Aeolun merged commit c9b512f into Aeolun:main Apr 23, 2026
4 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts text-selection behavior in the DiffViewer so selecting text on one side doesn’t also select content on the opposite side.

Changes:

  • On onMouseDown, clears any prior noSelect state and applies noSelect only to the opposite side (left vs right).
  • Removes the previous onMouseUp cleanup logic (replaced with a no-op handler).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/index.tsx
Comment on lines +817 to +820
const rightElements = document.getElementsByClassName("right");
for (let i = 0; i < rightElements.length; i++) {
rightElements.item(i).classList.remove(this.styles.noSelect);
}
Comment thread src/index.tsx
Comment on lines +825 to +829
const opposite = document.getElementsByClassName(
prefix === LineNumberPrefix.LEFT ? "right" : "left",
);
for (let i = 0; i < elements.length; i++) {
const element = elements.item(i);
element.classList.add(this.styles.noSelect);
for (let i = 0; i < opposite.length; i++) {
opposite.item(i).classList.add(this.styles.noSelect);
Comment thread src/index.tsx
element.classList.remove(this.styles.noSelect);
}
}}
onMouseUp={() => {}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants